
#ifndef __BROKER_MESSAGE_H
#define __BROKER_MESSAGE_H

#include <apr_file_io.h>
#include "../iface/debug.h"
#include "../db/ActorsDB.h"
#include "../db/KeyDB.h"
#include "../net/EncMessage.h"

class BrokerMessage : public EncMessage
{
   public:
      BrokerMessage(apr_pool_t *imp) : EncMessage(imp) {}
      void TakeAndInsertPublicKeyByName(KeyDB *kdb, int payload_number, const char *iformat, ...);
      void TakeAndInsertOwnedPublicKeyByName(KeyDB *kdb, int payload_number, const char *iowner, const char *iformat, ...);
      void AttachPublicKeyByName(KeyDB *kdb, const char *iformat, ...);
      void AttachPublicKey(KeyPair *apubkey);
      void TakeAndInsertPrivateKeyByName(KeyDB *kdb, int payload_number, const char *iformat, ...);
      void TakeAndInsertOwnedPrivateKeyByName(KeyDB *kdb, int payload_number, const char *iowner, const char *iformat, ...);
      void AttachPrivateKeyByName(KeyDB *kdb, const char *iformat, ...);
      void AttachPrivateKey(KeyPair *aprvkey);
      int TakeAndWriteOutFileByName(int payload_number, const char *iformatfname, ...);
      int TakeAndCWriteOutFileByName(int payload_number, const char *iformatfname, ...);
      int TakeAndCTWriteOutFileByName(int payload_number, const char *iformatfname, ...);
      apr_size_t AttachHashThenFileByName(const char *iformatfname, ...);
      void AttachXMLDescriptorByName(const char *iformatfname, ...);
      void AttachEncryptedXMLDescriptorByName(KeyDB *keydb, const char *keyname, const char *iformatfname, ...);
      void UpdateAndAttachXMLDescriptorByName(int *cancel, int *blocknumber, const char *cname, KeyPair *trialkey, const char *directoryname, const char *iformatfname, ...);
      void VerifyPermissions(ActorsDB *adb, const char *iprocessor, const char *iprocessee);
      void VerifySenderIsCompute(ActorsDB *adb, const char *iprocessor);
};

#endif
